package com.great.service.impl;

import com.github.pagehelper.PageHelper;
import com.great.dao.UserDao;
import com.great.domain.User;
import com.great.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;


    @Override
    public List<User> searchuser(int page, int size, String keyword) {
        PageHelper.startPage(page,size);
        return userDao.searchuser(keyword);
    }

    @Override
    public void deluser(String id) {
        userDao.deluser(id);
    }

    @Override
    public void adduser(User user) {
        userDao.adduser(user);
    }

    @Override
    public void openuser(String id) {
        userDao.openuser(id);
    }

    @Override
    public void closeuser(String id) {
        userDao.closeuser(id);
    }

    @Override
    public User finById(String id) {
       return userDao.findById(id);
    }

    @Override
    public void updateById(User user) {
        userDao.updateById(user);
    }

    @Override
    public int usernamecheck(String user_Name) {
        return userDao.usernamecheck(user_Name);
    }

    @Override
    public User selectbyname(String user_Name, String user_Password) {
        return userDao.selectbyname(user_Name,user_Password);
    }

}
